package com.ft.oa.domain.project;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ft.oa.utils.SecurityUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 项目质保期实体类
 * @author liyansheng
 * @ClassName ProjectWarranty
 * @date 2022-1-14 09:36:46
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "project_warranty",autoResultMap = true)
public class ProjectWarranty {

    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 验收主键id
     */
    private Long examineId;

    /**
     * 质保次数
     */
    @TableField(exist = false)
    private int times;

    /**
     * 回款次数次数
     */
    @TableField(exist = false)
    private int moneyTimes;

    /**
     * 项目编码
     */
    private String projectNumber;

    /**
     * 项目名称
     */
    private String projectName;

    /**
     * 质保项目名称
     */
    private String warrantyName;

    /**
     * 合同总额
     */
    private BigDecimal totalMoney;

    /**
     * 回款总额
     */
    private BigDecimal totalReturnAmount;

    /**
     * 未回款金额
     */
    @TableField(exist = false)
    private BigDecimal notTheReceivable;

    /**
     * 质保状态 0-质保中 1-质保结束 2-续保
     */
    private Integer warrantyStatus;

    /**
     * 质保负责人
     */
    private Integer qualityAssuranceOfficer;

    /**
     * 质保负责人名字
     */
    @TableField(exist = false)
    private String qualityAssuranceOfficerName;

    /**
     * 质保名称
     */
    @TableField(exist = false)
    private String warrantyStatusName;

    /**
     * 预计回款日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
    private LocalDate estimatedDateOfPayment;

    /**
     * 起始日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
    private LocalDate startDate;

    /**
     * 结束日期
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
    private LocalDate endDate;

    /**
     * 创建人id
     */
    private Long creator = SecurityUtils.getCurrentUser().getId();

    /**
     * 创建时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
    private LocalDateTime createTime = LocalDateTime.now();

    /**
     * 修改人id
     */
    private Long editor = SecurityUtils.getCurrentUser().getId();

    /**
     * 修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
    private LocalDateTime updateTime = LocalDateTime.now();
    /**
     * 剩余尾款
     */
    private BigDecimal finalPayment;

    /**
     * 是否有有待解决问题
     */
    @TableField(exist = false)
    private Integer problemState;
}
